
const mongoose = require('mongoose')

//创建集合规则 courseSchema 中就是集合的规则
const BookSchema = new mongoose.Schema({
    book_author: {
        type: String,
        required: true
    },
    book_title: {
        type: String,
        required: true,
        unique:true
    },
    book_coverurl:{
        type:String,
    },
    book_number:{  //字数
        type:String,
    },
    book_type: {    //分类
        type: String,
    },
    book_describe: {    //描述
        type: String,
    },
    url_arr:{
        type:Array
    }
})

//使用规则创建集合
const Book = mongoose.model("Book", BookSchema) //courses文件名 ,以上部分可以看成创建了一个类


module.exports = {
    Book
}